#ifndef __BOARD_H_
#define __BOARD_H_
#include <string.h>
#include "stm8s.h"
#include "STM8S105K.h"
#include "stm8s_conf.h"

#include "eeprom_user.h"
#include "motor.h"
#include "led.h"
#include "key.h"
#include "USER_UART2.h"
#include "ir.h"
#include "SHT2x.h"
#include "sm1616.h"
#include "display.h"
#include "pm25.h"
#include "TVOC.h"

_Bool FMQ  				@PD_ODR:3;
_Bool POWER  			@PD_ODR:4;
_Bool ION  				@PA_ODR:1;
_Bool CHECK	 			@PE_IDR:5;
#define	SAFE_GET_TICK(tick)	\
	do {		\
		tick = tick_now;	\
	} while (tick != tick_now)
	
typedef struct{
	u32 tick_temp;
	u32 tick_begin;
}TICK;
typedef struct{
	u8 second;
	u8 mintue;
}MYTIME;
typedef struct{
	u8 cmd_updata;
	u8 power;
	u8 speed;
	u8 ion;
	u8 mode;
	u8 lock;
	u8 light;
	u8 wifi;
	u8 openDevice;
}FLAG;


extern FLAG flag;
extern u32 tick_now;
extern u8 sersonGrade,sendHeart;
void checkOnOff(void);
void cmdUpdate(void);
void boardInit(void);
void delayMs(u16 dat);
void sysTimeUpdate(void);
void fmqRun(u8 dat);
void autoModePro(void);
u8 checkFilterGrade(void);
void doCloseDevice(void);
void doOpenDevice(void);
#endif
